package com.yycx.module.bus.provider.handler.haiying.tasktodo.saleman;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.yycx.bpm.provider.common.handler.ProcInstDeleteHandler;
import com.yycx.common.base.utils.FlymeUtils;
import com.yycx.common.constants.CommonConstants;
import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.module.bus.client.entity.BusSaleman;
import com.yycx.module.bus.client.entity.hy.HyOrder;
import com.yycx.module.bus.provider.handler.haiying.BusinessUtils;
import com.yycx.module.bus.provider.service.BusSalemanService;
import com.yycx.module.bus.provider.service.hy.HyOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 业务员流程实例删除回调
 *
 * @author zyf
 */
@Component
@Slf4j
public class SaleManProcDeleteHandler implements ProcInstDeleteHandler {

    @Resource
    private BusSalemanService salemanService;


    @Override
    public boolean support(String processDefinitionKey) {
        return false;
    }

    @Override
    @DSTransactional
    public ResultBody success(String businessKey, String processInstanceId) {
        salemanService.updateSaleManState(Long.parseLong(businessKey), null, -2);
        return ResultBody.ok();
    }
}
